#include <iostream>

void printIfRight(const int *stack, const unsigned length, const unsigned n, const bool isOdd)
{
	unsigned sum = 0u;
	for (unsigned i = 0u; i != length; ++i)
		sum += stack[i] * 2;

	if (isOdd)
		sum -= stack[length - 1];

	if (sum == n)
	{
		unsigned i;
		for (i = 0u; i != length; ++i)
			std::cout << stack[i];

		if (isOdd)
			--i;

		while (i--)
			std::cout << stack[i];

		std::cout.put('\n');
	}
}

void findPalindrome(const unsigned n, unsigned length)
{
	if (!length)
		return;

	bool isOdd = length % 2;

	length = (isOdd ? length / 2 + 1 : length / 2);

	int *stack = new int[length]();
	stack[0] = 1;
	
	unsigned top = length;

	while (true)
	{
		printIfRight(stack, length, n, isOdd);

		while (stack[--top] == 9 && top)
			continue;

		if (stack[top] == 9)
			break;

		while (top != length)
		{
			stack[top] = (stack[top] + 1) % 10;
			++top;
		}
	}

	delete[] stack;
}

int main()
{
	unsigned n;

	std::cin >> n;

	findPalindrome(n, 5);
	findPalindrome(n, 6);

	return 0;
}